package cn.gzsxt.music.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

import cn.gzsxt.music.query.UserQueryObject;

@Mapper
public interface UserMapper {

	@SelectProvider(type=UserProvider.class,method="getUserTotalByQo")
	Long selectUserTotalByQo(UserQueryObject qo);

	@SelectProvider(type=UserProvider.class, method = "selectUserListByQo")
	List<Map<String, Object>> selectUserListByQo(UserQueryObject qo);

	@Insert("insert into mc_user (user_name,user_pass,user_gender,user_signature,"
			+ "user_email,user_tel,role_id,user_icon,user_date,user_Status) values "
			+ "(#{user_name},#{user_pass},#{user_gender},#{user_signature},#{user_email},"
			+ "#{user_tel},#{role_id},#{user_icon},#{user_date},#{user_Status})")
	int insert(Map<String, Object> params);

	@DeleteProvider(type=UserProvider.class,method="deleteUserByIds")
	int deleteUserById(Map<String, Object> userIdMap);

	@Update("update mc_user set user_name = #{user_name},user_pass = #{user_pass},"
			+ "user_gender = #{user_gender},user_signature = #{user_signature},user_email = #{user_email},"
			+ "user_tel = #{user_tel},role_id = #{role_id},user_icon = #{user_icon},"
			+ "user_date = #{user_date},user_Status = #{user_Status} where user_id = #{user_id}")
	int update(Map<String, Object> params);

	@Select("select * from mc_user where user_name = #{user_name}")
	List<Map<String, Object>> checkByUname(String user_name);

}
